package com.hnevc.jdbc;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;




public class JDBCDemo {

public static void main(String[] args) throws ClassNotFoundException, SQLException {
	Class.forName("com.mysql.jdbc.Driver");
	String url = "jdbc:mysql://localhost:3306/jdbc";
	String username = "root";
	String password = "123456";
	Connection con = DriverManager.getConnection(url,username,password);
		String sql = "update users set name=Tom where id=?";
	PreparedStatement pStmt = con.prepareStatement(sql);
	pStmt.setInt(1, 1);
	int number = pStmt.executeUpdate(sql);
	pStmt.close();
	con.close();
}

}
